<?php

namespace app\admin\controller\ldcms;

use addons\ldcms\model\Visit;
use app\admin\model\Admin;
use app\admin\model\User;
use app\common\controller\Backend;
use app\common\model\Attachment;
use fast\Date;
use think\Db;

/**
 * 控制台
 *
 * @icon   fa fa-dashboard
 * @remark 用于展示当前系统中的统计数据、统计报表及重要实时数据
 */
class Dashboard extends Backend
{

    /**
     * 查看
     */
    public function index()
    {

        $this->view->assign([
            'zh_cn_day_visit'          => Visit::where('lang','zh-cn')->whereTime('create_time', 'today')->count(),
            'zh_cn_total_visit'        => Visit::where('lang','zh-cn')->count(),
            'zh_cn_month_visit'        => Visit::where('lang','zh-cn')->whereTime('create_time', 'last month')->count(),
            'zh_cn_week_visit'      => Visit::where('lang','zh-cn')->whereTime('create_time', 'last week')->count(),
            'ar_day_visit'          => Visit::where('lang','ar')->whereTime('create_time', 'today')->count(),
            'ar_total_visit'        => Visit::where('lang','ar')->count(),
            'ar_month_visit'        => Visit::where('lang','ar')->whereTime('create_time', 'last month')->count(),
            'ar_week_visit'      => Visit::where('lang','ar')->whereTime('create_time', 'last week')->count(),
            'day_art_visit'   => \addons\ldcms\model\Document::whereTime('create_time', 'today')->count(),
            'total_art_visit'    => \addons\ldcms\model\Document::count(),
        ]);


        return $this->view->fetch();
    }

}
